package com.atguigu.mvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 * @版本： V5.1.0
 * @版权： Copyright @ 2025 广东广昱信息科技有限公司版权所有
 * @作者： 广东广昱信息科技有限公司
 * @日期： 2025-06-01 18:07
 */
@Controller
//@RequestMapping("hello")
public class RequestMappingController {
    @RequestMapping(
            value = {"/testRequestMapping",  "/test"},
            method = {RequestMethod.GET, RequestMethod.POST},
            params = {"username"}
    )
    public String success() {
        //设置视图名称
        return "success";
    }

    @GetMapping("/testGetMapping")
    public String testGetMaping() {
        return "success";
    }

    @RequestMapping(value = "/testPut", method = RequestMethod.PUT)
    public String testPut() {
        return "success";
    }

    @RequestMapping(
            value = "/testParamsAndHeaders",
            params={"username","password!=123456"},
            headers = {"Host=localhost:8080"}
    )
    public String testParamsAndHeaders() {
        return "success";
    }

    //@RequestMapping("/a?a/testAnt")
    //@RequestMapping("/a*a/testAnt")
    @RequestMapping("/**/testAnt")
    public String testAnt() {
        return "success";
    }


    @RequestMapping("/testPath/{id}/{username}")
    public String testPath(@PathVariable("id") Integer id,@PathVariable("username")String username) {
        System.out.println("id:"+id+",username:"+username);
        return "success";
    }
}
